// user.js 作用是存放 和用户相关的请求
// 登录、注册、更换头像、重置密码............

import request from '@/utils/request'

// 注册的请求
export const regAPI = obj => {
  // obj = { username: '', password: '', repassword: '' }
  return request.post('/api/reg', obj)
}

// 登录的请求
export const loginAPI = obj => {
  return request.post('/api/login', obj)
}

// 获取用户信息
export const getUserAPI = () => request.get('/my/userinfo')

// 更新用户信息
export const updateUserAPI = obj => request.put('/my/userinfo', obj)

// 修改密码
export const updatePwdAPI = data => request.patch('/my/updatepwd', data)

// 上传头像
export const uploadAPI = str => request.patch('/my/update/avatar', { avatar: str })
